<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<html>
<head>
    <title>部门列表</title>
    <%@include file="/jsp/public/header.jsp" %>
</head>
<body>

<div id="Title_bar">
    <div id="Title_bar_Head">
        <div id="Title_Head"></div>
        <div id="Title"><!--页面标题-->
            <img border="0" width="13" height="13"
                 src="${pageContext.request.contextPath}/style/images/title_arrow.gif"/> 部门管理
        </div>
        <div id="Title_End"></div>
    </div>
</div>

<div id="MainArea">
    <table cellspacing="0" cellpadding="0" class="TableStyle">

        <!-- 表头-->
        <thead>
        <tr align=center valign=middle id=TableTitle>
            <td width="150px">部门名称</td>
            <td width="150px">上级部门名称</td>
            <td width="200px">职能说明</td>
            <td>相关操作</td>
        </tr>
        </thead>

        <!--显示数据列表-->
        <tbody id="TableData" class="dataContainer" datakey="departmentList">
        <c:forEach items="${departmentList}" var="d">
            <tr class="TableDetail1 template">
                <td>
                    <a href="list.do?parentId=${d.depid}" >
                        ${d.name}
                    </a>&nbsp;
                </td>
                <td>${d.parent.name}&nbsp;</td>
                <td>${d.description}&nbsp;</td>
                <td>
<%--                    <a href="delete.do?id=${d.depid}">删除</a>--%>
                    <a onclick="del(${d.depid})">删除</a>
                    <a href="editUI.do?id=${d.depid}">修改</a>
                </td>
            </tr>
        </c:forEach>
        </tbody>
    </table>

    <!-- 其他功能超链接 -->
    <div id="TableTail">
        <div id="TableTail_inside">
            <a href="addUI.do?parentId=${deptId}" ><img
                    src="${pageContext.request.contextPath}/style/images/createNew.png"/></a>

            <s:if test="parentId != null">
                <a href="listTop.do?parentId=${parentId}" >
                    <IMG SRC="${pageContext.request.contextPath}/style/blue/images/button/ReturnToPrevLevel.png"/>
                </a>
            </s:if>
        </div>
        <!--分页信息-->
        <%@include file="/jsp/public/pageView.jsp" %>
    </div>
</div>

<!--说明-->
<div id="Description">
    说明：<br/>
    1，列表页面只显示一层的（同级的）部门数据，默认显示最顶级的部门列表。<br/>
    2，点击部门名称，可以查看此部门相应的下级部门列表。<br/>
    3，删除部门时，同时删除此部门的所有下级部门。
</div>

<script>
    function del(id) {
        if (confirm("确认删除此部门及其子部门吗")) {
            window.location="${pageContext.request.contextPath}/department/delete.do?id=" + id;
        }
    }
</script>
</body>
</html>
